<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>

<security:authorize ifAllGranted="ROLE_USER">

<div id="heading" class="section">
	<h2>Llena tu lista</h2>
</div>
<p>
    Invia a tus amigos para que compartan cotigo este momento <br/>
    Ingresa su nombre y e-mail<br/>
</p>
<div id="hotelResults" class="section">

    <form:form modelAttribute="contacto" action="agregar" method="post">
        <div class="field">
                <div class="label">Discoteca:</div>
                <div class="input">${lista.codigoDiscoteca.nombre}</div>
         </div><br/>
         <div class="field">
                <div class="label">Fecha</div>
                <div class="input">${lista.fecha2}</div>
         </div><br/>
        <div class="field">
                <div class="label">
                        <label for="searchString">Nombre:</label>
                </div>
                <div class="input">
                    <form:input id="nombre" path="nombre"/>
                    <script type="text/javascript">
                Spring.addDecoration(new Spring.ElementDecoration({
                        elementId : "nombre",
                        widgetType : "dijit.form.ValidationTextBox",
                        widgetAttrs : { promptMessage : "Ingresa el nombre de tu amigo." }}));
              </script>
                </div>
          </div><br/>
          <div class="field">
                <div class="label">
                    <label for="searchString">Email:</label>
                </div>
                <div class="input">
                    <form:input id="correo" path="correo"/>
                    <script type="text/javascript">
                Spring.addDecoration(new Spring.ElementDecoration({
                        elementId : "correo",
                        widgetType : "dijit.form.ValidationTextBox",
                        widgetAttrs : { promptMessage : "Ingresa el correo de tu amigo." }}));
              </script>
                </div>
          </div>

           <div class="field">
                <div class="label">
                        <label for="searchString">Importar tus contactos del facebook:</label>
                </div>
                <div class="input">
                    <a href="importar">Importar del Facebook</a>
                </div>
          </div>

        <div class="buttonGroup">
            <input type="submit" id="bagregar" name="bagregar" value="Agregar" />
            <script type="text/javascript">
                    Spring.addDecoration(new Spring.AjaxEventDecoration({
                            elementId: "bagregar",
                            event: "onclick",
                            params: {fragments: "body"}
                    }));
            </script>
	</div>

        </form:form>

    <c:if test="${not empty contactos}">
	<table class="summary">
		<thead>
			<tr>
                            <th>Nombre</th>
                            <th>Email</th>
                            <th>Action</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach var="amigo" items="${contactos}">
				<tr>
					<td>${amigo.nombre}</td>
					<td>${amigo.correo}</td>
					<td><a href="detele?id=${amigo.codigo}">Quitar</a></td>
				</tr>
			</c:forEach>
			<c:if test="${empty contactos}">
				<tr>
					<td colspan="5">No hay amigos registrados</td>
				</tr>
			</c:if>
		</tbody>
	</table>
	<div class="buttonGroup">
		<c:if test="${searchCriteria.page > 0}">
			<a id="prevResultsLink" href="search?searchString=${searchCriteria.searchString}&pageSize=${searchCriteria.pageSize}&page=${searchCriteria.page - 1}">Previous Results</a>
			<script type="text/javascript">
				Spring.addDecoration(new Spring.AjaxEventDecoration({
					elementId: "prevResultsLink",
					event: "onclick",
					params: {fragments: "body"}
				}));
			</script>
		</c:if>
		<c:if test="${not empty hotelList && fn:length(hotelList) == searchCriteria.pageSize}">
			<a id="moreResultsLink" href="search?searchString=${searchCriteria.searchString}&pageSize=${searchCriteria.pageSize}&page=${searchCriteria.page + 1}">More Results</a>
			<script type="text/javascript">
				Spring.addDecoration(new Spring.AjaxEventDecoration({
					elementId: "moreResultsLink",
					event: "onclick",
					params: {fragments: "body"}
				}));
			</script>
		</c:if>
	</div>
    </c:if>

 &nbsp;<br/>
        &nbsp;<br/>
        &nbsp;<br/>
        &nbsp;<br/>
        &nbsp;<br/>
       
	<div class="buttonGroup">
             <a id="atras" href="reserva1">Atras</a>
            <a id="siguiente" href="confirmar">Siguiente</a>
	</div>
</div>	

</security:authorize>